package kos.robert.fruits;

import java.util.Random;

public class Apple implements Runnable {
	String name;
	int time;
	Random r = new Random();

	public Apple(String s) {
		name = s;
		time = r.nextInt(1001);
	}

	@Override
	public void run() {
		try {
			System.out.printf("%s is sleeping for %d\n", name, time);
			Thread.sleep(time);
			System.out.printf("%s is done\n", name);
		} catch (InterruptedException e) {
			System.out.printf("Thread %s has been interrupted\n", name);
		}
	}
}
